home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / Delphi 3.0 / DATA.Z / STATIMPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-30  |  5.3 KB  |  204 lines

  1. unit StatImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelLib;
  8.  
  9. type
  10.   TStaticTextX = class(TActiveXControl, IStaticTextX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TStaticText;
  14.     FEvents: IStaticTextXEvents;
  15.     procedure ClickEvent(Sender: TObject);
  16.     procedure DblClickEvent(Sender: TObject);
  17.   protected
  18.     { Protected declarations }
  19.     procedure InitializeControl; override;
  20.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  21.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  22.     function Get_AutoSize: WordBool; safecall;
  23.     function Get_BorderStyle: TxStaticBorderStyle; safecall;
  24.     function Get_Caption: WideString; safecall;
  25.     function Get_Color: TColor; safecall;
  26.     function Get_Cursor: Smallint; safecall;
  27.     function Get_DragCursor: Smallint; safecall;
  28.     function Get_Enabled: WordBool; safecall;
  29.     function Get_Font: Font; safecall;
  30.     function Get_ParentColor: WordBool; safecall;
  31.     function Get_ShowAccelChar: WordBool; safecall;
  32.     function Get_Visible: WordBool; safecall;
  33.     procedure AboutBox; safecall;
  34.     procedure Set_AutoSize(Value: WordBool); safecall;
  35.     procedure Set_BorderStyle(Value: TxStaticBorderStyle); safecall;
  36.     procedure Set_Caption(const Value: WideString); safecall;
  37.     procedure Set_Color(Value: TColor); safecall;
  38.     procedure Set_Cursor(Value: Smallint); safecall;
  39.     procedure Set_DragCursor(Value: Smallint); safecall;
  40.     procedure Set_Enabled(Value: WordBool); safecall;
  41.     procedure Set_Font(const Value: Font); safecall;
  42.     procedure Set_ParentColor(Value: WordBool); safecall;
  43.     procedure Set_ShowAccelChar(Value: WordBool); safecall;
  44.     procedure Set_Visible(Value: WordBool); safecall;
  45.   end;
  46.  
  47. implementation
  48. uses StaticPg;
  49. { TStaticTextX }
  50.  
  51. procedure TStaticTextX.InitializeControl;
  52. begin
  53.   FDelphiControl := Control as TStaticText;
  54.   FDelphiControl.OnClick := ClickEvent;
  55.   FDelphiControl.OnDblClick := DblClickEvent;
  56. end;
  57.  
  58. procedure TStaticTextX.EventSinkChanged(const EventSink: IUnknown);
  59. begin
  60.   FEvents := EventSink as IStaticTextXEvents;
  61. end;
  62.  
  63. procedure TStaticTextX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  64. begin
  65.   { Define property pages here.  Property pages are defined by calling
  66.     DefinePropertyPage with the class id of the page.  For example,
  67.       DefinePropertyPage(Class_StaticTextXPage); }
  68. end;
  69.  
  70. function TStaticTextX.Get_AutoSize: WordBool;
  71. begin
  72.   Result := FDelphiControl.AutoSize;
  73. end;
  74.  
  75. function TStaticTextX.Get_BorderStyle: TxStaticBorderStyle;
  76. begin
  77.   Result := Ord(FDelphiControl.BorderStyle);
  78. end;
  79.  
  80. function TStaticTextX.Get_Caption: WideString;
  81. begin
  82.   Result := WideString(FDelphiControl.Caption);
  83. end;
  84.  
  85. function TStaticTextX.Get_Color: TColor;
  86. begin
  87.   Result := FDelphiControl.Color;
  88. end;
  89.  
  90. function TStaticTextX.Get_Cursor: Smallint;
  91. begin
  92.   Result := Smallint(FDelphiControl.Cursor);
  93. end;
  94.  
  95. function TStaticTextX.Get_DragCursor: Smallint;
  96. begin
  97.   Result := Smallint(FDelphiControl.DragCursor);
  98. end;
  99.  
  100. function TStaticTextX.Get_Enabled: WordBool;
  101. begin
  102.   Result := FDelphiControl.Enabled;
  103. end;
  104.  
  105. function TStaticTextX.Get_Font: Font;
  106. begin
  107.   GetOleFont(FDelphiControl.Font, Result);
  108. end;
  109.  
  110. function TStaticTextX.Get_ParentColor: WordBool;
  111. begin
  112.   Result := FDelphiControl.ParentColor;
  113. end;
  114.  
  115. function TStaticTextX.Get_ShowAccelChar: WordBool;
  116. begin
  117.   Result := FDelphiControl.ShowAccelChar;
  118. end;
  119.  
  120. function TStaticTextX.Get_Visible: WordBool;
  121. begin
  122.   Result := FDelphiControl.Visible;
  123. end;
  124.  
  125. procedure TStaticTextX.AboutBox;
  126. begin
  127.   ShowStaticTextXAbout;
  128. end;
  129.  
  130. procedure TStaticTextX.Set_AutoSize(Value: WordBool);
  131. begin
  132.   FDelphiControl.AutoSize := Value;
  133. end;
  134.  
  135. procedure TStaticTextX.Set_BorderStyle(Value: TxStaticBorderStyle);
  136. begin
  137.   FDelphiControl.BorderStyle := TStaticBorderStyle(Value);
  138. end;
  139.  
  140. procedure TStaticTextX.Set_Caption(const Value: WideString);
  141. begin
  142.   FDelphiControl.Caption := TCaption(Value);
  143. end;
  144.  
  145. procedure TStaticTextX.Set_Color(Value: TColor);
  146. begin
  147.   FDelphiControl.Color := Value;
  148. end;
  149.  
  150. procedure TStaticTextX.Set_Cursor(Value: Smallint);
  151. begin
  152.   FDelphiControl.Cursor := TCursor(Value);
  153. end;
  154.  
  155. procedure TStaticTextX.Set_DragCursor(Value: Smallint);
  156. begin
  157.   FDelphiControl.DragCursor := TCursor(Value);
  158. end;
  159.  
  160. procedure TStaticTextX.Set_Enabled(Value: WordBool);
  161. begin
  162.   FDelphiControl.Enabled := Value;
  163. end;
  164.  
  165. procedure TStaticTextX.Set_Font(const Value: Font);
  166. begin
  167.   SetOleFont(FDelphiControl.Font, Value);
  168. end;
  169.  
  170. procedure TStaticTextX.Set_ParentColor(Value: WordBool);
  171. begin
  172.   FDelphiControl.ParentColor := Value;
  173. end;
  174.  
  175. procedure TStaticTextX.Set_ShowAccelChar(Value: WordBool);
  176. begin
  177.   FDelphiControl.ShowAccelChar := Value;
  178. end;
  179.  
  180. procedure TStaticTextX.Set_Visible(Value: WordBool);
  181. begin
  182.   FDelphiControl.Visible := Value;
  183. end;
  184.  
  185. procedure TStaticTextX.ClickEvent(Sender: TObject);
  186. begin
  187.   if FEvents <> nil then FEvents.OnClick;
  188. end;
  189.  
  190. procedure TStaticTextX.DblClickEvent(Sender: TObject);
  191. begin
  192.   if FEvents <> nil then FEvents.OnDblClick;
  193. end;
  194.  
  195. initialization
  196.   TActiveXControlFactory.Create(
  197.     ComServer,
  198.     TStaticTextX,
  199.     TStaticText,
  200.     Class_StaticTextX,
  201.     23,
  202.     '{5A5659C9-7975-11D0-BE02-00A024D1875C}');
  203. end.
  204.